#ifndef __USART_H
#define __USART_H 		
#include <stdbool.h>
#include "air32f10x.h"


struct usart_rx_t
{
	bool status;
	int size;
	const int max;
	char * const buf;
};

extern struct usart_rx_t usart1_rx;
extern struct usart_rx_t usart2_rx;

void USART1_Init(uint32_t bound);
void USART2_Init(uint32_t bound);
void USART1_SendByte(int ch);
void USART2_SendByte(int ch);
void USART1_Send(unsigned char *s);
void USART2_Send(unsigned char *s);
void USART1_Send_N(char *s,int n);
void USART2_Send_N(char *s,int n);

void printf_buffer(void *buffer, int size);

void usart1_clear_rx(void);
void usart2_clear_rx(void);

#endif

